#pragma once

#include "bitmapData.h"

class Utils
{
public:
	template <typename t>
	static void SetPixel(const FTLib::BitmapLockInfo lockInfo, uint32_t x, uint32_t y, const t& value)
	{
		*((t*)((((char*)lockInfo.ptrDataRoi) + y*lockInfo.pitch) + x*sizeof(t))) = value;
	}

	static const char* WICPixelFormatToInformalString(const GUID& guid);

	static void ComplexToTwoReals(std::shared_ptr<FTLib::IBitmapData> input, std::shared_ptr<FTLib::IBitmapData>& output1, std::shared_ptr<FTLib::IBitmapData>& output2);
	static std::shared_ptr<FTLib::IBitmapData> Utils::RealToGray16NormalizedDestroyInput(std::shared_ptr<FTLib::IBitmapData> input);
	static std::shared_ptr<FTLib::IBitmapData> Utils::RealToGray8NormalizedDestroyInput(std::shared_ptr<FTLib::IBitmapData> input);

	static int CalcOrder(uint32_t x);

	static void MultiplyWithOneAndMinusOne(float* ptr, uint32_t pitch, uint32_t width, uint32_t height);

	static void CalcMinMaxValues_32f(std::shared_ptr<FTLib::IBitmapData> bm, double minPercentile, double maxPercentile, float* ptrMin, float* ptrMax);

	static void NormalizeFloatImage(std::shared_ptr<FTLib::IBitmapData> image);

	static void NormalizeFloatImage(std::shared_ptr<FTLib::IBitmapData> image,float minValue,float maxValue);

	static std::uint32_t GetBytesPerPel(FTLib::PixelType pixeltype);
};